package iedcyt.acute.controller.listeners.signComparison;

import iedcyt.acute.model.SignComparisonModel;
import iedcyt.acute.view.SignComparisionView;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

public class Sign1SelectionListener implements Listener {

	private SignComparisonModel _model;
	private SignComparisionView _view;
	
	public Sign1SelectionListener(SignComparisionView view, SignComparisonModel model) {
		this._model = model;
		this._view = view;
	}
	
	public void handleEvent(Event event) {
		Integer idSign = _view.getSelectedSign1ID();
		_model.setSelected_sign1IdSign(idSign);
		update_view();
	}

	private void update_view() {
			
		_view.loadDocuments1(_model.getSign1Docs());
		_view.loadCenters1(_model.getSign1Centers(), _model.isSign1CentersWarning());
		_view.loadCorps1(_model.getSign1Corps(), _model.isSign1CorpsWarning());
		_view.loadSignsCollaborators1(_model.getSign1CollSigns());
		_view.loadAuthorsCollaborators1(_model.getSign1CollAuthors());
		
		_view.compareTables();
	}
}
